﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LDM.Framework.WebApiClientCore
{
    public class HostProvider
    {
        private readonly IConsulProvider dbProvider;

        public HostProvider(IConsulProvider dbProvider)
        {
            this.dbProvider = dbProvider;
            //将HostProvider放到依赖注入容器中，即可从容器获取其它服务来实现动态的服务地址查询
        }

        internal string ResolveService(string name)
        {
            //如何获取动态的服务地址由你自己决定，此处仅以简单的接口定义简要说明
            return dbProvider.SelectServiceUri(name);
        }
    }
}
